package com.douya.pangu.application.sys.service;

import cn.hutool.json.JSONUtil;
import com.douya.common.utils.BeanUtils;
import com.douya.pangu.api.aop.FeignLogAspect;
import com.douya.pangu.api.constant.TripartiteConsumerConstant;
import com.douya.pangu.api.pojo.bo.ClientLogBO;
import com.douya.pangu.application.sys.pojo.entity.es.CoreLogEsDO;
import com.douya.pangu.application.sys.repository.CoreLogRepository;
import lombok.extern.slf4j.Slf4j;
import org.apache.rocketmq.client.producer.DefaultMQProducer;
import org.apache.rocketmq.client.producer.SendResult;
import org.apache.rocketmq.client.producer.SendStatus;
import org.apache.rocketmq.common.message.Message;
import org.apache.rocketmq.spring.core.RocketMQTemplate;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

/**
 * @Author hcy
 * @Date 2023/6/13
 */
@Service
@Slf4j
public class FeignLog extends FeignLogAspect {

//    @Resource
//    RocketMQTemplate rocketMqTemplate;
//
//    @Resource
//    CoreLogRepository coreLogRepository;

    @Override
    protected void sendLog(ClientLogBO clientLogBO) {
        log.info("发送日志:{}", JSONUtil.toJsonStr(clientLogBO));
//        try {
//            CoreLogEsDO coreLog = new CoreLogEsDO();
//            BeanUtils.copyPropertiesIgnoreNull(clientLogBO, coreLog);
//            coreLogRepository.save(coreLog);
//        } catch (Exception e) {
//            log.error("发送日志失败", e);
//        }
    }
}
